<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>

<body>
    <div id="root">

        <h2 v-once>初始化的值是:{{n}}</h2>
        <h2>当前的n值是:{{n}}</h2>
        <button @click="n++">点我n+1</button>
    </div>

</body>

</html>
<script>
    new Vue({
        el: '#root',
        data: {
            n: 1
        }
    })
</script>
<!-- 
    v-once指令:
        1. v-once所在的节点在初次动态渲染后, 就视为静态内容了
        2. 以后数据的改变不会引起v-once在结构的更新, 可以用于优化性能

-->